#include <UARTINIT.h>

sbit led = P3^7;
char cmd;

void InitUart(){

	TMOD &= 0x0F;
	TMOD |= 0x20;
	AUXR &= 0xBF;
	AUXR &= 0xFE;
	SCON  = 0x50;
	TH1   = 0xFD;
	TL1   = 0xFD;
	TR1   = 1;
	EA    = 1;
	ES    = 1;

}

void SendByte(char data_masg){
	
	SBUF = data_masg;
	while(!TI);
	TI = 0;
}

void Sendstring(char* str){

	while( *str != '\0'){
		
		SendByte(*str);
		str++;
	}
}



void Uart_Handler() interrupt 4
{
	if(RI)//中断处理函数中，对于接收中断的响应
	{
		RI = 0;//清除接收中断标志位
		cmd = SBUF;
		if(cmd == 'o'){
			led = 0;//点亮led
		}
		if(cmd == 'c'){
			led = 1;//熄灭led
		}
	}
if(TI);
}